
//常用正则
const phone = /^1([3]|[5]|[7]){1}\d{9}$/;
const email = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
const number = /^[0-9]+.[0-9]+$/;

export const isPhone = str => phone.test(str);

export const isEmail = str => email.test(str);

export const isNumber = str => number.test(str);

//数据类型检测
export const isType = (type , obj) => Object.prototype.toString.call(obj) === '[object ' + type + ']';

export const isObj = (obj) => Object.prototype.toString.call(obj) === '[object Object]';

export const isArr = (arr) => Object.prototype.toString.call(arr) === '[object Array]';

export const isStr = (str) => Object.prototype.toString.call(str) === '[object String]';

export const isNum = (num) => Object.prototype.toString.call(num) === '[object Number]';

export const isFunc = (func) => Object.prototype.toString.call(func) === '[object Function]';



